// 算了, 放弃吧, C++ long long 会溢出, 不信你拿915试试.
// We were trying to share an orange ICPC Central Russia Regional Contest
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll sieve_size = 1e3+10;
bitset<sieve_size> bs;
vector<int> primes;
void sieve() {
  bs.set();
  bs[0]=bs[1]=0;
  for(ll i=2; i<=sieve_size; ++i) {
    if(bs[i]) {
      for(ll j=i*i; j<=sieve_size; j+=i) {
        bs[j]=0;
      }
      primes.push_back(i);
    }
  }
}
vector<int> prime_factorize(ll N) {
  vector<int> factors;
  ll pf_idx = 0, pf = primes[pf_idx];
  while(pf*pf<=N) {
    while(N%pf==0) {N /= pf; factors.push_back(pf);}
    pf = primes[++pf_idx];
  }
  if(N!=1) {factors.push_back(N);}  // Cornor case: N itself is a prime
  return factors;
}

ll qexp(int a, int b) {
  if(b==0)return 1;
  ll res = qexp(a, b/2);
  res = res*res;
  if(b&1)res=res*a;
  return res;
}

int main() {
  sieve();
  int n; while(cin>>n) {
  vector<int> factorized = prime_factorize(n);
  sort(factorized.begin(), factorized.end(), greater<int>());
  int len = min(primes.size(), factorized.size());
  ll ans=1;
  for(int i=0; i<len; ++i) {
    ans *= qexp(primes[i], factorized[i]-1);
  }
  cout<<ans<<'\n';
  }
}
